/*
 *
 *
 */

#include "Smiley.h"
#ifndef _SMILEY_CPP_
#define _SMILEY_CPP_


/*
 *
 */
Smiley::Smiley(void)
{
    ax = 0;
    ay = 0;
    vx = 0;
    vy = 0;
    initialTime = 0;
    finalTime = 0;
}

/*
 * 
 */
Smiley::Smiley(const Smiley &smile):Animation(smile), ax(smile.ax), ay(smile.ay), vx(smile.vx), vy(smile.vy), show(smile.show), alive(smile.alive), initialTime(smile.initialTime), finalTime(smile.finalTime)
{

}

/*
 *
 */
Smiley::Smiley(string fileName,float size,float ax,float ay,float vx,float vy,int x, int y, int initialTime, int finalTime):Animation(fileName,x,y,FRAME_TIME,N_FRAMES,size), ax(ax), ay(ay), vx(vx), vy(vy), initialTime(initialTime), finalTime(finalTime)
{
    show = false;
    alive = true;
}

/*
 * 
 */
Smiley& Smiley::operator=(const Smiley &smile)
{
    if (this == &smile) 
        return *this;
    else 
    {
        Animation::operator=(smile);
        ax = smile.ax;
        ay = smile.ay;
        vx = smile.vx;
        vy = smile.vy;
        show = smile.show;
        alive = smile.alive;
        initialTime = smile.initialTime;
        finalTime = smile.finalTime;
    }
    return *this;
}

/*
 * 
 */ 
Smiley::~Smiley(void)
{
    
}

/*
 * 
 */
void Smiley::render(SDL_Surface *screen)
{
    if(show)
        Animation::render(screen);
}

/*
 * 
 */ 
void Smiley::update(int tDelta)
{
    Animation::update(tDelta);
    /*calculo da movimentacao do smile*/
    vx = vx + ax*tDelta;
    vy = vy + ay*tDelta;
    
    x = x + vx*tDelta;
    y = y + vy*tDelta;
}

/*
 * 
 */ 
void Smiley::setShow(bool show)
{
    this->show = show;
}

/*
 * 
 */ 
void Smiley::setAlive(bool alive)
{
    this->alive = alive;
}

/*
 * 
 */ 
bool Smiley::getAlive(void)
{
   return alive; 
}

/*
 * 
 */ 
int Smiley::getInitialTime(void)
{
    return initialTime;
}

/*
 * 
 */ 
int Smiley::getFinalTime(void)
{
    return finalTime;
}

#endif
